<template>
  <div class="layout-header-container">
    <div class="layout-header-left">
      <img class="layout-header-left-img" src="../../assets/vue.svg" alt="">
      <h4 class="layout-header-left-title ml-3">
        商城后台管理系统
      </h4>
    </div>
    <div class="layout-header-right">
      <button class="btn btn-light" @click="onLogout">退出</button>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from 'vue-router'
const router = useRouter() // 实例化路由对象
const onLogout = () => {
  // 1. 清除用户的登陆信息（token） 2. 跳回到登录页
  window.localStorage.removeItem('token')
  router.push('/login')
}
</script>

<style></style>